{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 手写识别系统"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**说明：**\n",
    "\n",
    "将数据集文件 'digits.zip' 解压至当前文件夹"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 定义将图像转换为向量函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 导入程序所需要的模块\n",
    "import numpy as np\n",
    "import operator\n",
    "from os import listdir"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def img2vector(filename):\n",
    "    returnVect = np.zeros((1, 1024))    # 存储图片像素的向量维度是1x1024\n",
    "    fr = open(filename)\n",
    "    for i in range(32):\n",
    "        lineStr = fr.readline()\n",
    "        for j in range(32):\n",
    "            returnVect[0, 32*i+j] = int(lineStr[j])    # 图片尺寸是32x32，将其依次放入向量returnVect中\n",
    "    return returnVect"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 定义 k 近邻算法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def classify0(inX, dataSet, labels, k):    # inX是测试集，dataSet是训练集，lebels是训练样本标签，k是取的最近邻个数\n",
    "    dataSetSize = dataSet.shape[0]    # 训练样本个数\n",
    "    diffMat = np.tile(inX, (dataSetSize, 1)) - dataSet    # np.tile: 重复n次\n",
    "    sqDiffMat = diffMat**2\n",
    "    sqDistances = sqDiffMat.sum(axis=1)\n",
    "    distances = sqDistances**0.5    # distance是inX与dataSet的欧氏距离\n",
    "    sortedDistIndicies = distances.argsort()    # 返回排序从小到达的索引位置\n",
    "    classCount = {}   # 字典存储k近邻不同label出现的次数\n",
    "    for i in range(k):\n",
    "        voteIlabel = labels[sortedDistIndicies[i]]\n",
    "        classCount[voteIlabel] = classCount.get(voteIlabel, 0) + 1    # 对应label加1，classCount中若无此key，则默认为0\n",
    "    sortedClassCount = sorted(classCount.items(), key=operator.itemgetter(1), reverse=True)    # operator.itemgetter 获取对象的哪个维度的数据\n",
    "    return sortedClassCount[0][0]    # 返回k近邻中所属类别最多的哪一类"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 定义手写数字识别系统函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def handwritingClassTest():\n",
    "    # 训练样本\n",
    "    hwLabels = []\n",
    "    trainingFileList = listdir('./digits/trainingDigits')           #导入训练集\n",
    "    m = len(trainingFileList)\n",
    "    trainingMat = np.zeros((m, 1024))\n",
    "    for i in range(m):\n",
    "        fileNameStr = trainingFileList[i]     # fileNameStr 得到的是每个文件名称，例如\"0_0.txt\"\n",
    "        fileStr = fileNameStr.split('.')[0]     #去掉“.txt”，剩下“0_0”\n",
    "        classNumStr = int(fileStr.split('_')[0])    # 按下划线‘_' 划分“0_0”,取第一个元素为类别标签\n",
    "        hwLabels.append(classNumStr)\n",
    "        trainingMat[i, :] = img2vector('./digits/trainingDigits/%s' % fileNameStr)\n",
    "    # 测试样本\n",
    "    testFileList = listdir('./digits/testDigits')        #iterate through the test set\n",
    "    errorCount = 0.0\n",
    "    mTest = len(testFileList)\n",
    "    for i in range(mTest):\n",
    "        fileNameStr = testFileList[i]    # fileNameStr 得到的是每个文件名称，例如\"0_0.txt\"\n",
    "        fileStr = fileNameStr.split('.')[0]     #去掉“.txt”，剩下“0_0”\n",
    "        classNumStr = int(fileStr.split('_')[0])    # 按下划线‘_' 划分“0_0”,取第一个元素为类别标签\n",
    "        vectorUnderTest = img2vector('./digits/testDigits/%s' % fileNameStr)\n",
    "        classifierResult = classify0(vectorUnderTest, trainingMat, hwLabels, 3)    # 调用knn函数\n",
    "        print(\"the classifier came back with: %d, the real answer is: %d\" % (classifierResult, classNumStr))\n",
    "        if (classifierResult != classNumStr): errorCount += 1.0\n",
    "    print(\"\\nthe total number of errors is: %d\" % errorCount)\n",
    "    print(\"\\nthe total error rate is: %f\" % (errorCount/float(mTest)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 7, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 9, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 3, the real answer is: 5\n",
      "the classifier came back with: 6, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 6, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 3, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 1, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 1, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 1, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 7, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "\n",
      "the total number of errors is: 10\n",
      "\n",
      "the total error rate is: 0.010571\n"
     ]
    }
   ],
   "source": [
    "handwritingClassTest()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
